from flask import Flask, request

app = Flask(__name__)

@app.route("/hello/<user>")
def hello(user):
    print(type(user))
    return f"hello {user}"


@app.route("/book/<int:id>")
def find_book(id):
    print(type(id))
    return f"书本的id是{id}"


@app.route("/user/add",methods=["get","post"])
def add_user():
    age = request.args.get(key="age",default=18,type=int)
    return f"您的年龄是{age}"

if __name__ == '__main__':
    app.run()